def flatten(t): return [item for sublist in t for item in sublist]. As evidence, you can use the timeit module in the standard library: $ python -mtimeit ... ... <看更多>
Any subset of the axes may be flattened. The shape of the data may change, but the size will not. The flattening is executed in row-major (C-style) order. ... <看更多>